package entity

import "encoding/json"

type UserUpgrade struct {
	Id                int64           `gorm:"column:id;primary_key" json:"id"`
	UserId            int64           `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
	UserName          string          `gorm:"column:user_name;type:varchar(255);not null" json:"user_name"`
	UserPhone         string          `gorm:"column:user_phone;type:varchar(255);not null" json:"user_phone"`
	PlanId            int64           `gorm:"column:plan_id;type:bigint;not null" json:"plan_id"`
	PlanName          string          `gorm:"column:plan_name;type:varchar(255);not null" json:"plan_name"`
	StrategyId        int64           `gorm:"column:strategy_id;type:bigint;not null" json:"strategy_id"`
	UpgradeType       int             `gorm:"column:upgrade_type;type:bigint;not null" json:"upgrade_type"`
	EbikeId           int64           `gorm:"column:ebike_id;type:bigint;not null" json:"ebike_id"`
	EbikeName         string          `gorm:"column:ebike_name;type:varchar(255);not null" json:"ebike_name"`
	EbikeSnCode       string          `gorm:"column:ebike_sn_code;type:varchar(255);not null" json:"ebike_sn_code"`
	EbikeTypeId       int64           `gorm:"column:ebike_type_id;type:bigint;not null" json:"ebike_type_id"`
	EbikeTypeName     string          `gorm:"column:ebike_type_name;type:varchar(255);not null" json:"ebike_type_name"`
	Detail            json.RawMessage `json:"detail"`
	Progress          float32         `json:"progress"`
	Status            int             `gorm:"column:status;type:integer;not null" json:"status"`
	StatusDetail      json.RawMessage `gorm:"column:status_detail;type:json;not null" json:"status_detail"`
	UpgradingStatus   int             `gorm:"column:upgrading_status;type:integer;not null" json:"upgrading_status"`
	FailureReason     string          `gorm:"column:failure_reason;type:varchar(255);not null" json:"failure_reason"`
	FailureLatestTime int64           `gorm:"column:failure_latest_time;type:varchar(255);not null" json:"failure_latest_time"`
	RetryCount        int             `gorm:"column:retry_count;type:integer;not null" json:"retry_count"`
	CreatedAt         int64           `gorm:"column:created_at;type:bigint;not null" json:"created_at"`
	UpdatedAt         int64           `gorm:"column:updated_at;type:bigint;not null" json:"updated_at"`
}

func (u *UserUpgrade) TableName() string {
	return "user_upgrade"
}
